import request from "@/utils/request";
import { SkuListResult } from "@/api/product/sku/type.ts";

enum API {
  // /admin/product/list/{page}/{limit}
  SKU_LIST_URL = "admin/product/list/",
  // /admin/product/onSale/{skuId}
  SKU_ON_SALE_URL = "admin/product/onSale/",
  // /admin/product/cancelSale/{skuId}
  SKU_CANCEL_SALE_URL = "admin/product/cancelSale/",
  // /admin/product/getSkuInfo/{skuId} 获取sku详情
  SKU_DETAIL_URL = "admin/product/getSkuInfo/",
  // /admin/product/deleteSku/{skuId} delete 删除sku
  SKU_DELETE_URL = "admin/product/deleteSku/",
}

// sku列表
export const reqSkuList = (page: number, limit: number) =>
  request.get<any, SkuListResult>(API.SKU_LIST_URL + `${page}/${limit}`);

// sku上架
export const reqSkuOnSale = (skuId: number) =>
  request.get<any, any>(API.SKU_ON_SALE_URL + `${skuId}`);

// sku下架
export const reqSkuCancelSale = (skuId: number) =>
  request.get<any, any>(API.SKU_CANCEL_SALE_URL + `${skuId}`);

// sku详情
export const reqSkuDetail = (skuId: number) =>
  request.get<any, any>(API.SKU_DETAIL_URL + `${skuId}`);

// 删除sku
export const reqSkuDelete = (skuId: number) =>
  request.delete<any, any>(API.SKU_DELETE_URL + `${skuId}`);
